package cloud.daodao.storm.common.security.api;

import cloud.daodao.storm.common.constant.AppConstant;
import cloud.daodao.storm.common.model.Request;
import cloud.daodao.storm.common.model.Response;
import cloud.daodao.storm.common.security.constant.SecurityConstant;
import cloud.daodao.storm.common.security.model.aes.AesCipherData;
import cloud.daodao.storm.common.security.model.aes.AesCipherParam;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;

/**
 * @author DaoDao
 */
@Tag(name = "AesApi", description = "AesApi")
@HttpExchange(url = AppConstant.API)
public interface AesApi {

    @Operation(summary = "AES 加密", description = "@DaoDao 输入 AES 密钥 和 向量，加密数据")
    @PostExchange(url = SecurityConstant.AES_ENCRYPT)
    Response<AesCipherData> aesEncrypt(@RequestBody @Valid Request<AesCipherParam> request);

    @Operation(summary = "AES 解密", description = "@DaoDao 输入 AES 密钥 和 向量，解密数据")
    @PostExchange(url = SecurityConstant.AES_DECRYPT)
    Response<AesCipherData> aesDecrypt(@RequestBody @Valid Request<AesCipherParam> request);

}
